package com.wifi.unti;

public class PageInfo {

    private Integer pageNum = 1;//第几页
    private Integer pageSize = 10;//每页多少条
    private Integer totalPage = 0;//一共多少页
    private Integer totalNum = 0;//一共多少条
    private Integer start = 0;

    private Object list;

    public PageInfo(String pageNumStr,String pageSizeStr,Integer totalNum ){
        if (!StringUtil.isEmpty(pageSizeStr)){
            this.pageSize = Integer.valueOf(pageSizeStr);
        }
        if (!StringUtil.isEmpty(pageNumStr)){
            this.pageNum = Integer.valueOf(pageNumStr);
        }
        this.totalNum = totalNum;
        //如何判断总页数   总页数 = 总条数 / 每页条数
        this.totalPage = totalNum % pageSize == 0 ? totalNum/pageSize : totalNum/pageSize +1;
        //如何 计算出 开始的 条数
        /**
         * 页数       开始          每页size
         * 1          0             10
         * 2          10            10
         * 3          20            10
         * 4          (4-1)*10      10
         *
         */
        this.start = (pageNum -1)*pageSize;

    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public Integer getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }

    public Integer getStart() {
        return start;
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    public Object getList() {
        return list;
    }

    public void setList(Object list) {
        this.list = list;
    }
}
